<strong></strong><template>
	<view class="wrap">
		<view class="search">
			<u-search v-model="keywords" @custom="search" @search="search"></u-search>
		</view>
		<u-index-list :scrollTop="scrollTop" :sticky="false">
			<u-index-item>
				<view class="list-cell" @click="navTo('/pages/sys/book/tree')">
					<view class="home-icon icon-color04">
						<i class="iconfont icon-icon_yingyongguanli"></i>
					</view>
					<view class="app-name">组织架构</view>
				</view>
				<view class="list-cell" @click="navTo('/pages/sys/book/teacher')">
					<view class="home-icon icon-color01">
						<i class="iconfont icon-peoples"></i>
					</view>
					<view class="app-name">我的部门</view>
				</view>
			</u-index-item>
			<u-index-item class="personal-listitem" v-for="(items, idx) in indexList" :key="idx" :use-slot="true" >
				<u-index-anchor :text="indexList[idx]" :index="items" bgColor="#f5f5f5" color="#666666"/>
				<view class="list-cell" v-for="(item, index) in getRandomInt(1,3)" :key="index"
					@click="navTo('/pages/sys/personal-details/personal-details')">
					<u-avatar class="user-images" :text="nameList[index].substring(0,1)" :src="getReandomImage(index)" shape="square" :size="35" randomBgColor></u-avatar>
					<view class="user-name"><span>{{nameList[index]}}</span><span
							class="user-other">{{deptList[index]}}</span></view>
				</view>
			</u-index-item>
		</u-index-list>
		<u-divider>已经到底了</u-divider>
		<bottomTabbar :current="2"></bottomTabbar>
	</view>
</template>

<script>
export default {
	data() {
		return {
			keywords: '',
			scrollTop: 0,
			indexList: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
				"T", "U",
				"V", "W", "X", "Y", "Z"
			],
			nameList: ['林逸飞', '李晨曦', '白飞', '百威',],
			deptList: ['教师', '勤工俭学', '读者协会', '志愿者协会'],
			imageList: ['user01', 'user02', 'user03', 'user04', 'user05', 'user06'],
		}
	},
	onLoad() {
	},
	onPageScroll(e) {
		this.scrollTop = e.scrollTop;
	},
	methods: {
		getRandomInt(min, max) {
			let data = Math.floor(Math.random() * (max - min + 1)) + min;
			return data;
		},
		getRandomName() {
			const length = this.nameList.length;
			const i = this.getRandomInt(0, length - 1);
			return this.nameList[i];
		},
		getRandomDept() {
			const length = this.deptList.length;
			const i = this.getRandomInt(0, length - 1);
			return this.deptList[i];
		},
		getReandomImage(i) {
			// return '/static/aidex/images/' + this.imageList[i] + '.png';
			return;
		},
		navTo(url) {
			uni.navigateTo({
				url: url
			});
		},
	}
};
</script>

<style lang="scss">
@import 'addressBook.scss';
page {
	background-color: #f5f5f5;
}

.wrap .search {
	background: #ffffff;
}

.list-cell {
	display: flex;
	box-sizing: border-box;
	width: 100%;
	padding: 8px 24rpx;
	overflow: hidden;
	color: #323233;
	font-size: 14px;
	line-height: 24px;
	background-color: #fff;
	align-items: center;
	border-bottom: 1px solid #ececec !important;
}

.personal-listitem .list-cell:last-of-type {
	border-bottom: 0 !important;
}

.home-icon {
	height: 35px;
	width: 35px;
	
	i {
		font-size: 44rpx;
	}
}

.u-avatar {
	&--square {
		border-radius: 10px;
	}
}

.user-images {
	margin-right: 10px;
}

.user-name {
	font-size: 28rpx;
	color: #000000;
	
	flex: 1;

	span {
		display: block;
	}

	.user-other {
		font-size: 22rpx;
		color: #999999;
		font-weight: normal;
	}
}

.app-name {
	font-size: 28rpx;
	color: #000000;
	flex: 1;
	margin-left: 10px;
}
</style>
